﻿var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_beginRequest(beginRequest);
prm.add_endRequest(endRequest);

var progress = 0;

function beginRequest(sender, args)
{
    progress = 1;
    setTimeout("ModalTimer()", 2000);
}

function endRequest(sender, args)
{
    progress = 0;
    LoadingPanel.Hide();
}

function ModalTimer()
{
    if (progress == 1) {
        LoadingPanel.Show();
    }
}